<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script type="text/javascript" src="vue.js">
			
		</script>
		<!--ajax input output system-->
		<script type="text/javascript" src="axios.min.js">
			
		</script>
	</head>
	<body>
		<div id="app">
			用户名:<input v-model="username" /><br>
			密码:<input v-model="password" /><br>
			确认密码:<input v-model="confirmPassword" />
			<button v-on:click="register">注册</button>
		</div>
	</body>
	<script>
		//配置对象
		var config={
			el:"#app",
			data:{
				username:"",
				password:"",
				confirmPassword:""
			},
			methods:{
				register:function(){
					//加断点
					debugger;
					//判断两个密码是否一致
					if (this.password !=this.confirmPassword){
						window.alert("密码不一致");
						return;
					}
					var serverUrl="http://localhost:1314/user/register?"
					+"username="+this.username+
					"&password="+this.password;
					console.log(serverUrl);
					//用axios联网
					axios.get(serverUrl)
					.then(function(response){
						debugger;
						console.log(response);
						window.alert(response.data);
					})
					.catch(function(e){
						window.alert("联网失败");
						console.log(e);
					});
					
				}
			}
			
		}
		//启动vue
		var vue=new Vue(config);
	</script>
</html>







